package com.crazy.base.common.core.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseException extends RuntimeException {

    private int code;

    private String msg;

    public static BaseException of(String msg) {
        return new BaseException(-1, msg);
    }

    public static BaseException of(ExceptionEnum e) {
        return new BaseException(e.getCode(), e.getMsg());
    }

}
